<template>
    <!-- 组件结构 -->
    <div class="student">
        <h2>学生姓名：{{name}}</h2>
        <h2>学生性别：{{sex}}</h2>
        <button @click="triggerHello">点击发送学生姓名给School</button>
    </div>
</template>
<script>
    import pubsub from 'pubsub-js'
    export default {
        name: 'Student',
        data(){
            return{
            }
        },
        setup(){
            const name = 'Aurora'
            const sex='男'
            const triggerHello = ()=>{
                
                pubsub.publish('hello',666)
            }
            return{
                name,
                sex,
                triggerHello
            }
        },
    }
</script>
<style scoped>
    .student{
        background-color: pink;
        padding:5px;
        margin-top: 30px;
    }
</style>
